<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ATM机</title>
    <script>
        var sum = 100;
        alert('1.存钱\n2.取钱\n3.查询余额\n4.退出');
        var num = prompt('请选择服务项目');
        if (num == 1) {
            var price1 = prompt('请输入你要存的金额');
            sum += parseFloat(price1);
            alert(sum);
        } else if (num == 2) {
            var price2 = prompt('请输入你要取的金额');
            sum -= parseFloat(price2);
            if (sum >= 0) {
                alert('您的余额是' + sum);
            } else {
                alert('余额不足');
            }
        } else if (num == 3) {
            alert(sum);
        } else if (num == 5) {
            alert('正在退出');
        }
    </script>
</head>

<body>

</body>

</html>